//对象状态变化会引起行为的变化
 class NetworkState
 {
 public:
 	NetworkState* pNext;
 	virtual void Operation1() = 0;
 	virtual void Operation2() = 0;
 	virtual void Operation3() = 0;

 	virtual ~NetworkState();
 };

 class OpenState :public NetworkState 
 {
 static NetworkState* m_instance;

 public:
 	static NetworkState* getInstance()
 	{
 		if(m_instance == nullptr)
 		{
 			m_instance = new OpenState();
 		}
 	}

 	void Operation1()
 	{
 		//...
 		pNext = closeState::getInstance();
 	}

 	void Operation2()
 	{
 		//...
 		pNext = ConnectState::getInstance();
 	}

 	void Operation3()
 	{
 		//...
 		pNext = OpenState::getInstance();
 	}
 }

class CloseState: public NetworkState
{
public:
	CloseState();
	~CloseState();
	
};

class WaitState:public NetworkState
{
	//...
}

//Processor 永远不用改变，只需要扩展状态
 class NetworkProcessor
 {
 	NetworkState* pState;
 public:
 	NetworkProcessor(NetworkState* pState)
 	{
 		this->pState = pState;
 	}

 	void Operation1()
 	{
 		pState->Operation1();
 		pState = pState->pNext;
 	}

 	void Operation2()
 	{
 		pState->Operation2();
 		pState = pState->pNext;
 	}

 	void Operation3()
 	{
 		pState->Operation3();
 		pState = pState->pNext;
 	}
 };